package com.ysd.lis.controller.eq;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.eq.EqPatrolPlan;
import com.ysd.lis.request.CommonPageDto;
import com.ysd.lis.request.eq.EqPatrolPlanDto;
import com.ysd.lis.service.eq.EqPatrolPlanService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 设备巡检计划 前端控制器
 * </p>
 *
 * @author WH
 * @since 2024-08-23
 */
@RestController
@RequestMapping("/api/eq/patrolPlan")
public class EqPatrolPlanController extends BaseController {

    @Autowired
    private EqPatrolPlanService eqPatrolPlanService;

    @ApiOperation("分页查询")
    @GetMapping("/findPatrolPlanPageList")
    public Result findPatrolPlanPageList(CommonPageDto pageParam) {
        return eqPatrolPlanService.findPatrolPlanPageList(pageParam);
    }

    @ApiOperation("巡检任务查询")
    @GetMapping("/findPatrolList")
    public Result findPatrolList(EqPatrolPlanDto eqPatrolPlanDto) {
        return eqPatrolPlanService.findPatrolList(eqPatrolPlanDto);
    }

    @ApiOperation("新增巡检计划")
    @PostMapping("/addPatrolPlan")
    public Result addPatrolPlan(@RequestBody EqPatrolPlan eqPatrolPlan) {
        return eqPatrolPlanService.addPatrolPlan(eqPatrolPlan);
    }

    @ApiOperation("编辑巡检计划")
    @PostMapping("/editPatrolPlan")
    public Result editPatrolPlan(@RequestBody EqPatrolPlan eqPatrolPlan) {
        return eqPatrolPlanService.editPatrolPlan(eqPatrolPlan);
    }

    @ApiOperation("启动或暂停巡检计划")
    @PostMapping("/patrolPlanStopStart")
    public Result patrolPlanStopStart(@RequestBody EqPatrolPlan eqPatrolPlan) {
        return eqPatrolPlanService.patrolPlanStopStart(eqPatrolPlan);
    }

    @ApiOperation("执行巡检计划")
    @GetMapping("/handleExecutePlan")
    public Result handleExecutePlan(EqPatrolPlan eqPatrolPlan) {
        return eqPatrolPlanService.handleExecutePlan(eqPatrolPlan);
    }


    @ApiOperation("通过id巡检任务")
    @GetMapping("/findPatrolPlanById")
    public Result findPatrolPlanById(EqPatrolPlan eqPatrolPlan) {
        return eqPatrolPlanService.findPatrolPlanById(eqPatrolPlan);
    }

    @ApiOperation("批量删除巡检计划")
    @PostMapping("/deletePatrolPlan")
    public Result deletePatrolPlan(@RequestBody List<EqPatrolPlan> eqPatrolTaskes) {
        return eqPatrolPlanService.deletePatrolPlan(eqPatrolTaskes);
    }
}
